﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using System.Data;

namespace HelperService
{
  // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together.
  [ServiceContract]
  public interface IHelperService
  {
    [OperationContract]
    string GetMyName(string name);

    [OperationContract]
    bool CreateQueue(string queueName);

    [OperationContract]
    DataSet GetQueueList();

    [OperationContract]
    bool SendMessage(string deviceID, string queueName, string message);

    [OperationContract]
    string GetMessage(string deviceID, string queueName, bool delete);

    [OperationContract]
    bool Delete(string queueName, string messageID, string receipt);

    [OperationContract]
    int GetQueueDepth(string queueName);

    [OperationContract]
    List<string> GetTablesList();

    [OperationContract]
    bool CreateTable(string tableName);

    [OperationContract]
    bool DeleteTable(string tableName);

    [OperationContract]
    List<DeviceInfo> DisplayTable(string tableName);

    [OperationContract]
    List<CommTranslate> GetCommands();

    [OperationContract]
    bool DeviceTable_InsertRow(string tableName, string partitionKey, string rowKey, DeviceInfo device);

    [OperationContract]
    bool CommandsTable_InsertRow(string rowKey, CommTranslate commands);

    [OperationContract]
    bool CommandsTable_DeleteRow(string rowKey);
  }

  [DataContract]
  public class DeviceInfo
  {
    [DataMember]
    public string DeviceID
    {
      get;
      set;
    }

    [DataMember]
    public string DeviceName
    {
      get;
      set;
    }
  }

  [DataContract]
  public class CommTranslate
  {
    [DataMember]
    public string CommandID
    {
      get;
      set;
    }
    
    [DataMember]
    public string DeviceID
    {
      get;
      set;
    }

    [DataMember]
    public string TagOfCommand
    {
      get;
      set;
    }

    [DataMember]
    public string ActualComm
    {
      get;
      set;
    }
  }
}
